<?php

	class User{
		private $name;
		private $password;
		private $conn;
		
		function __construct($name, $password){
			$this->name = $name;
			$this->password = $password;
			$this->conn = conn();
		}
		
		public function checkLogin(){
			$query = "select * from Admin where Name = '".$this->name."' and Password = '".$this->password."'";
			echo $query;
			//$stmt = sqlsrv_query( $conn, $query , array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));
			//$row_count = sqlsrv_num_rows( $stmt );
			$stmt = $this->conn->query( $query );
			$row = $stmt->fetch( PDO::FETCH_ASSOC );
			if(empty($row['Name']))
				return 0;//没值
			else
				return 1;//有值
		}
	}
?>